<?php
include("connect.php");
?>

<?php
$css = '<link rel="stylesheet" type="text/css" media="all" href="asset/css/class_editprofile.css">';
$title = 'My Profile';
$pagename = 'my_profile';
$userid = $_SESSION['userid'];
?>

<?php
$sql = "select user_category from m_user where user_id=".$_SESSION['userid'];
$retval = mysql_query( $sql, $con );
while($row = mysql_fetch_array($retval))
	{
		$user_category = $row[0];
	}
if(isset($_SESSION["userid"]))
	{
		if($user_category ==9)
		{
			include("header_loggedinadmin.php");
		}else
		{
			include("header_loggedin.php");
		}
	}
else
{
	echo '<script>';
		echo "alert('Please Login!');";
		echo 'window.location = "index.php"';
		echo '</script>';
}
?>

<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript">

$(document).ready(function() {
 		$('#show_sub_categories').hide();
		
	$('#search_category_id').change(function(){
		 $('#show_sub_categories').fadeOut();
		$.post("get_child_category.php", {
			parent_id: $('#search_category_id').val()
		}, function(response){
			
			setTimeout("finishAjax('show_sub_categories', '"+escape(response)+"')", 400);
		});
		return false;
	});	
});

function finishAjax(id, response){
  $('#'+id).html(unescape(response));
  $('#'+id).fadeIn();
} 

</script>

<div id="blue_bg">
	<div id="main">
        <div class="wrapper">
        	<div id="content">
            	<div id="white_box">
                	<h3 class="flag_long">MY PROFILE</h3>
					<form action=check_edit_profile.php method="post" enctype="multipart/form-data">
					<?php
						$userid = $_SESSION["userid"];
						$query = "select photolink from m_user where user_id =".$userid;
						$result = mysql_query($query);
    					while($row = mysql_fetch_array($result))
						{
							$photolink =$row[0];
						}
						echo '<div id="photo_box"><img src="images/my_profile/'.$photolink.'" width=214 height =321 /></div>';
					?>
                
                    
                    <div id="profile_box">
                        <table>
                            <tr>
                                <td><span class="bold">First Name</span></td>
                                <td width="50px"></td>
                                <td><input type="text" name="fname" size="50" /></td>
                            </tr>
							<tr>
                                <td><span class="bold">Last Name</span></td>
                                <td width="50px"></td>
                                <td><input type="text" name="lname" size="50" /></td>
                            </tr>
                            <tr>
                                <td><span class="bold">Picture</span></td>
                                <td width="50px"></td>
                                <td><input type="file" name="img1" size="40"></td>
                            </tr>
                            <tr>
                                <td valign="middle"><span class="bold">Address</span></td>
                                <td width="50px"></td>
                                <td><textarea name="address" cols="43"></textarea></td>
                            </tr>
                            <tr>
                                <td><span class="bold">Post Code</span></td>
                                <td width="50px"></td>
                                <td><input type="text" name="postcode" size="10" /></td>
                            </tr>
                            <tr>
                                <td><span class="bold">Mobile Phone</span></td>
                                <td width="50px"></td>
                                <td><input type="text" name="mobilephone" size="20" /></td>
                            </tr>
                            <tr>
                                <td><span class="bold">Nationality</span></td>
                                <td width="50px"></td>
                                <td><input type="text" name="nationality" size="25" /></td>
                            </tr>
                            <tr>
                                <td><span class="bold">Course</span></td>
                                <td width="50px"></td>
                                <td>
									 <?php 
										echo  '<select name="course" class="droplist" id="search_category_id"><option value="0" selected="selected"> </option>';

										$sql = "select category_id, category_name from t_category";
										$result = mysql_query($sql);
										while($row = mysql_fetch_array($result))
										{
											echo '<option class="dropoption" value="'.$row[0].'">'.$row[1].'</option>';
										}
										echo "</select>";
									?>
                                	<!-- <select name="course">
                                        <option value="course">course</option>
                                        <option value="MIT">MIT</option>
                                    </select>-->
                                </td>
                            </tr>
                            <tr>
                                <td><span class="bold">Course Category</span></td>
                                <td width="50px"></td>
                                <td>
                                	<select name="major1" class="droplist" id="show_sub_categories"></select>
                                </td>
                            </tr>
                            <tr>
                                <td><span class="bold">Facebook E-mail</span></td>
                                <td width="50px"></td>
                                <td><input type="text" name="fbemail" size="50" /></td>
                            </tr>
                            <tr>
                                <td><span class="bold">Twitter ID</span></td>
                                <td width="50px"></td>
                                <td><input type="text" name="twitterid" size="50" /></td>
                            </tr>
                            <tr>
                                <td></td>
                                <td width="50px"></td>
                                <td><input type="submit" value="" id="submit_btn" /></td>
                            </tr>
                        </table>
           			</div>
					</form>
                    <div class="clear"></div>
                </div>
            </div>
        </div>
    </div>
</div>

<?php
include("footer.php");
?>

